﻿// Models/PracticeSession.cs - 练习会话模型
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WebApplication1.Models
{
    [Table("PracticeSessions")]
    public class PracticeSession
    {
        [Key]
        public int SessionId { get; set; }

        [Required]
        public int UserId { get; set; }

        [Required]
        public int ExamId { get; set; }

        public DateTime StartTime { get; set; }

        public DateTime? EndTime { get; set; }

        public int TotalQuestions { get; set; }

        public int CorrectAnswers { get; set; }

        // 导航属性
        [ForeignKey("UserId")]
        public virtual User User { get; set; }

        [ForeignKey("ExamId")]
        public virtual Exam Exam { get; set; }

        public virtual ICollection<PracticeAnswer> PracticeAnswers { get; set; }
    }
}